// 服务端
const Koa = require('koa');
const Static = require('koa-static');
const path = require('path');

const app = new Koa();

app.use(async (ctx, next)=>{
  if(ctx.path === '/api/list'){
    ctx.body = {name: 'ahhh', age: 123};
  }else {
    return next()
  }
})

app.use(Static(path.join(__dirname, 'client')));
app.use(Static(path.join(__dirname, 'node_modules')));

app.listen(3000, function () {
  console.log(`server start at 3000`);
});
